home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
COBOL
/
H309.ZIP
/
PSICO.ZIP
/
PSICO12.EXE
/
READTWO.P12
< prev
next >
Wrap
Text File
|
1993-02-12
|
26KB
|
708 lines
==============================================================================
TRANTOR LTD Home/Office 0639-633072
TRANTOR HOUSE Mobile 0836-795445
GREEN HEDGES
PONTARDAWE ROAD
BRYNCOCH
NEATH SA10 7YL Managing Director:
WEST GLAMORGAN N.H.Jennings, B.Sc, C.Eng, MBCS
SOUTH WALES, UK
==============================================================================
PSICO STRUCTURED COBOL GENERATOR
VERSION 1.1
==============================================================================
Contents
1. Conditions of sale
2. About TRANTOR and our software
3. Registration
4. Items supplied on the disk
5. Use and Performance
6. History
7. Documentation
8. Latest news
This software requires only a single drive, only 512k of memory, and uses
only text-mode screens, so it should run on almost ANY IBM-compatible PC.
==============================================================================
1. Conditions of sale
==============================================================================
Copyright is retained by the author. The software on this disk is NOT public
domain, and the purchaser is granted a limited licence to copy and distribute
it, subject to the following conditions:
No changes are made to any file
All files on the supplied disk are included on the copy
No charge is made other than a reasonable fee for media, postage and copying
==============================================================================
2. About TRANTOR and our software
==============================================================================
Trantor Ltd is a small consultancy specialising in software for ICL
mainframes. Our programs are installed on ICL Mainframes in the UK, and as
far away as Australia
Our current range includes the following items which run under ICL's VME
operating system (and some also on IBM mainframes under MVS). Please
contact us for further details.
ICL and IBM:
COBFORM : COBOL reformatter and Structured programming preprocessor
COBSTR : Creates program structure chart from the source code
(including PERFORMS and GO TO's)
ICL only:
PSICO : Structured COBOL development aid
MFE : MULTI_FILE_EDIT PC demo available on request
FAM : File_Amender PC demo available on request
MANTXREF : MANTIS cross reference PC demo available
MANTRA : MANTIS utilities
IBM PC:
COBFORM : as above
COBSTR : as above
COBXREF : COBOL Cross reference list
PSICO : Structured COBOL development aid
TRANSIT : Utility for copying files via floppy disk
MATCH : Interactive file compare (available soon)
2.1 COBOL Reformatter - COBFORM
===============================
This program allows you to reformat COBOL programs to conform to your
own preferred layout. It also contains a structured programming preprocessor
which converts structured programming commands into valid COBOL.
The layout of the converted program is defined in a table which specifies
the alignment of selected COBOL verbs, reserved words and datanames.
Two sample tables are supplied, one of which contains the structure verbs.
The table also allows you to perform global replacements of selected keywords
througout the text, thus you can change all occurrences of a dataname or a
paragraph name.
From version 2.8, COBOL MACROs are introduced. A library of well designed
and tested macros can make a substantial contribution to productivity, as
well as reducing the scope for program errors.
You can automatically insert Trace and Path Analysis code into a test
version of the source, and a number of other options are available, eg
number of columns indentation after an IF.
The reformatting table
======================
Up to 250 table entries are allowed in this version. Full details are given in
the User Guide provided.
2.1.1 The Reformatting process
==============================
The COBOL program is dissected into individual words. Each word is checked
against the reformatting table (unless it is a literal) to see what alignment
and/or textual replacement is required.
The output words are then reassembled into COBOL source statements and written
to the output file.
Error messages are embedded as comments in the output source file.
Certain words are subject to special processing, as noted below:
IF/ELSE )
SEARCH/WHEN ) All trigger automatic indentation. This is
AT END ) turned off by a full stop.
GO TO The word TO is treated as part of the GO, and is not
aligned. (The TO following a MOVE IS subject to alignment)
Textual replacement can be used to replace, eg PIC by PICTURE throughout
the source. Alignment is applied AFTER the substitution, so the output is
always correctly aligned.
You can also replace > by the words IS GREATER THAN if so inclined.
2.1.2 Input requirements
========================
a) For reformatting, the input should be a valid COBOL source.
It may have 4 or 6 digit line numbers, for compatibility with UTAH
source formats. The output will ALWAYS have 6 digit line numbers.
Line numbers are not actually necesssary, as the output numbers are
always generated.
If a non-existent file is specified, a COBOL error will be reported,
and the run is abandoned.
b) For preprocessing a structured program, input should be COBOL plus
the structure verbs defined elsewhere in this menu system.
c) The input table must also be specified. Two 'starter' tables are
provided, which can be amended as necessary for your own formatting
requirements.
2.1.3. Structured preprocessor.
===============================
This is built-in to the reformatter and allows the use of the following
structure constructs.
PROC command
============
SYNTAX:
PROC procname
PROCBEGIN
procedure-body
PROCEND
Notes: a) Structure commands may be in COBOL margin A or B
b) procname must be valid for a COBOL section name
c) procedure-body is an interation and/or a nest of structures
This command generates a COBOL section containing the specified structures.
EXAMPLE: PROC A-MAIN PROCBEGIN
OPEN INPUT INFILE
PERFORM B-PROCESS
CLOSE INFILE
STOP RUN
PROCEND
IPROC command
=============
SYNTAX: a) Inverted routine b) Multithread routine
IPROC procname IPROC procname
PSVNAME numeric-item PSVNAME numeric-array
PROCBEGIN PSVTHREAD numeric-item
procedure-body PROCBEGIN
PROCEND procedure-body
PROCEND
Notes: a) Structure commands may be in COBOL margin A or B
b) procname must be valid for a COBOL section name
c) procedure-body is an interation and/or a nest of structures
d) numeric-item is used as a state variable or as an array index
e) numeric-array is an array of state variables
This command generates a multi-state routine, which may be either single-thread
or multi-thread depending on whether a PSVTHREAD is specified.
An example of a multi-state routine is provided in the example BINTREE.STR
where it is used for creating a binary tree
RPROC command - Recursive procedure
===================================
SYNTAX: Multithread routine
RPROC procname
PSVNAME numeric-array
PSVTHREAD numeric-item
PROCBEGIN
procedure-body
PROCEND
Notes: a) Structure commands may be in COBOL margin A or B
b) procname must be valid for a COBOL section name
c) procedure-body is an interation and/or a nest of structures
d) numeric-item is used as a stack pointer
e) numeric-array is an array of state variables, used as a stack
This generates a recursive routine. Eaxmples are given in BINTREE.STR and
FACTORL.STR
The subcommand RCALL may be used only within a recursive procedure, and
performs the recursion.
SEQUENCE structure
==================
This contains a structure body which is always obeyed once.
The body may contain any mix of COBOL statements and structures.
EXAMPLE:
SEQUENCE
MOVE 1 TO WS-COUNT
ITERUNTIL WS-COUNT > 10
BEGIN
PERFORM DA-PROCESS
ADD 1 TO WS-COUNT
REPEAT
DISPLAY "FINISHED"
FI
For further examples, see BINTREE.STR supplied with the software.
SELECT structure
================
This contains a number (from 1 to 9999) of conditions, each followed by a
structure body to be obeyed if the condition is true.
Only one of the bodies will be obeyed.
The body may contain any mix of COBOL statements and structures.
Note that each condition must be delimited by the word BEGIN.
EXAMPLE:
SELECT
CASE WS-OPT = "A"
BEGIN
PERFORM CA-ASCENDING
CASE WS-OPT = "D" BEGIN
PERFORM DA-DESCENDING
OTHERWISE
DISPLAY "INVALID OPTION " WS-OPT
FI
For further examples, see BINTREE.STR supplied with the software.
ITERWHILE and ITERUNTIL structures
==================================
These allow repeated execution of selected code. The condition is always
evaluated at the START of the loop, allowing for the loop executed zero times
ie not at all, if the condition should so indicate.
The body may contain any mix of COBOL statements and structures.
EXAMPLE:
MOVE 0 TO WS-EOF WS-COUNT
READ INFILE AT END MOVE 1 TO WS-EOF.
ITERUNTIL WS-EOF = 1 ( or ITERWHILE WS-EOF = 0)
BEGIN
PERFORM DA-PROCESS
ADD 1 TO WS-COUNT
READ INFILE AT END MOVE 1 TO WS-EOF.
REPEAT
DISPLAY WS-COUNT " records processed"
In this example, the routine works even if there are no records on the input
file, and it correctly counts the number of records read.
For further examples, see BINTREE.STR supplied with the software.
Minor commands
==============
SREAD and SWRITE are synonymous, and perform pseudo-read (or pseudo-write)
operations.
They are valid only within an IPROC. The action is to save a note of the
current address in a state variable and exit from the routine. When the
routine is reentered, processing resumes at the next instruction rather
than at the start.
See PROC BA-BUILD-TREE in BINTREE.STR for a good example
RCALL performs a recursive call, and is valid only in an RPROC.
It saves the current address in a stack of state variables, increments
the stack pointer, and starts again at the beginning of the procedure.
At the end of the procedure, the stack is unwound, and processing resumes
at the previous level of the stack.
Examples are to be found in both FACTORL.STR and BINTREE.STR
2.1.4. COBOL MACROS
===================
A MACRO is defined as a block of code which can be copied into the COBOL
program, with certain key words replaced by user-specified text.
There are many reasons for doing this, amongst which are:
The MACRO code is predefined and pretested, and likely to be correct.
Coding is likely to be quicker, and there should be fewer compilation
errors.
Changes to standard functions or data definitions only affect the macro
definition.
Differences between different dialects of COBOL can be hidden in the
macros, with a suitable definition being used with each different
compiler.
MACRO DEFINITIONS
=================
A MACRO Definition is held in a file with extension .DEF, which must, for
the shareware version, be in the current directory. The registered version
contains a command-lime parameter MDIR which specifies the directory to be
used.
The definition contains two parts, the parameter definition and the text
definition.
Up to 20 parameters may be defined, each of which should be given a default
value. The parameter name is restricted to 16 characters, and the default
value to 30. If embedded spaces are required in a default value, it should
be enclosed within square brackets ([ ]).
The macro text starts after a MACBEGIN statement, and is ended by a MACEND
statement. It may contain ANY COBOL code, with the replaceable parameters
marked by a preceding &. Each parameter used MUST be defined in the list
of parameters, otherwise the code will be passed through unchanged.
The parameter name may be followed by an equals sign and a default value,
although this is not obligatory.
Layout is free format, within normal COBOL rules, so the following are both
acceptable:
1) MACRO
A
B = WS-LINE
C
=
PR-LINE
MACBEGIN
MOVE &A TO &B &C
MACEND
2) MACRO A B = WS-LINE C = PR-LINE MACBEGIN MOVE &A TO &B &C MACEND
Example of a macro definition
=============================
MACRO
TEXT = " "
COLUMN = 1
POINTER = WS-COL
DESTINATION = [PR-LINE WS-LINE]
DELIM = SIZE
MACBEGIN
MOVE &COLUMN TO &POINTER
STRING &TEXT
DELIMITED &DELIM INTO &DESTINATION
WITH POINTER &POINTER
DISPLAY "Column-&COLUMN"
MACEND
Note that the item to be replaced does not need to be a complete word, and
may also be held within a literal.
Thus "Column-&COLUMN" would be replaced by "Column-1" in the generated
COBOL text.
Invoking COBOL MACROS
=====================
Within a COBOL program, a macro is denoted by a !. Thus !MVTEXT will
include the macro stored in file MVTEXT.DEF.
The parameters are currently positional, and the macro statement is terminated
either by a full stop, or by giving all parameters BUT NOT BOTH!. Any
parameters not specified will assume their default values as coded in the
macro definition.
The statement follows the usual COBOL rules, ie it must be coded between
colums 8 and 72, and at least one space must be left between each item.
eg !MVTEXT WS-NAME 20 WS-COL PR-LINE.
Note that as the parameters are positional, in order to gave a value to the
fourth parameter, you must quote values for the first three.
See EXAMPLE.STR for a number of examples.
At a later release, you will be able to specify parameters by keyword, or
indicate defaulting parameters by commas if using positional parameters.
It will also be possible to spread a macro call over several lines, instead
of being restricted to one. I know how to do all this, it's just having the
time to implement it!
Thus: !MVTEXT TEXT = WS-NAME
DESTINATION = WS-LINE
DELIM = SPACE
or !MVTEXT WS-NAME,,,,SPACE
will be allowed later.
2.2. MULTI_FILE_EDIT
====================
This is a full-screen text editor for ICL 2900 and Series 39 mainframe
computers
It features
Simultaneous editing of a number of files,
Cut and paste between files
Split screen working
Editing of long records (up to 2040 bytes)
Hexadecimal screen edit
Built-in COBOL and SCL reformatters
Insertion of Path Analysis and Trace code into COBOL source
COBOL Animator, for single step execution with source display
Text compression
Built-in structured COBOL preprocessor
and many other useful functions.
A PC-based demonstration version, with tutorial file, is available from us
on request, for a nominal charge. (It requires at least 512k of memory.)
2.3. FAM - File Amender
=======================
For ICL 2900 and Series 39 mainframe computers.
This is an interactive utility for amending a serial or indexed file.
It features
Full screen record display, including datanames as well as the data
Conversion of data to and from COMPUTATIONAL, COMP-3 and hexadecimal
Automatic record initialisation
Insertion, amendment and deletion of records
Optional display of COBOL Group names and redefinitions
Print of selected records
Optional Autoprint of changed records
A PC demonstration version is available on request.
2.4. COBXREF - COBOL cross reference
====================================
This provides a sorted cross reference of COBOL programs. It includes all
items which contain only numeric or alphabetic characters. Therefore all
datanames, paragraph and section names, and some COBOL reserved words will
be included, as well as numeric literals and some PICTURE clauses. Most
COBOL verbs are filtered out.
All dialects of COBOL are allowed, provided that the standard COBOL card
layout is used, ie columns 1-6 for sequence, 7 for comment, 8-72 for source
text. The program should cope with quite large programs, with up to 3000
source lines, depending on the complexity and number of datanames.
2.5 MATCH : File comparison
===========================
This interactive file comparison will enable two text files to be
compared, with the differences between individual pairs of records
indicated.
When a mismatch occurs, the next 8 records of each file are displayed.
You will be able to step one or both files forwards until matching is
re-established, and the program then proceeds to the next mismatching pair.
A Preliminary is version available, without the fancy screens planned for
the full version.
2.6 PSICO
=========
This is a utility to assist with fast and accurate entry of structured
programs. (A version with extra facilities is already provided as part of
the MULTI_FILE_EDIT package on VME - use SCL proc RUNPS).
A template is provided for each program structure, and the COBOL code is
inserted into the template. Structure commands may also be entered, which
then trigger display of further templates.
Since all structuring is carried out by the program, it is impossible to
make errors in the input of structures, ie no missing END's, mismatched
WHILE and REPEAT etc.
The output is a structured program in a suitable form for input to COBFORM,
which will then convert it to standard (ANS74) COBOL. Alternatively, output
can be in ANS85 COBOL, in which case certain structured programming
extensions such as recursion will NOT be available.
Under VME, MULTIFILEEDIT is integrated with PSICO, and the program can be
further amended, converted to COBOL, compiled and tested, all within the
editor environment.
2.7 MANTIS utilities from TRANTOR
==================================
This package of utilities for ICL mainframes includes
MANTXREF Mantis source cross reference, available online within a
MANTIS service, and also as a normal MAC procedure
MANTEXPORT Extracts a MANTIS program from a cluster into a file
MANTIMPORT Uses Batch MANTIS to load a program from a file into a
cluster
MANT2COB Produces a COBOL record layout from a MANTIS external file
MANTSCREEN Prints or displays a list of datanames on a MANTIS screen,
in the order they occur on the screen.
MANTREFORM Reformats MANTIS source by splitting each line at a
statement terminator (Colon). Aids readibility of code.
* MANTIS is a registered trade mark of CINCOM
==============================================================================
3. Registration
==============================================================================
Please send £3 for the shareware version, or £10 for the registered version
of any of our programs, to the address given at the start of this file.
Prices valid as at 1st January 1993, but we reserve the right to vary these
if necessary. If this copy is more than 1 year old, check with us first.
==============================================================================
4. Items supplied on the PSICO disk
==============================================================================
These files may be supplied individually, or may be zipped up in a
self-extracting archive depending on the source from which you obtained them.
File Content
==== =======
WHATSNEW News about the latest version
README.P12
READTWO.P12 This file
PSICO.EXE PSICO
PSHELP.C74 Online help file for mode S (ANS74 COBOL)
PSHELP.C85 Online help file for mode C (ANS85 COBOL)
HELP.ASC Introductory message
KEYS.DOC Explanation of script file format, and key values
CFASK.CFG Configuration file
MERGE3.ASK Tutorial self-running script
FILEA )
FILEB ) Test data files for program MATCH3 generated by the demo
FILEC )
FACTORL.STR A sample structured source, for a program to calculate
factorials using a recursive algorithm.
It must be preprocessed by COBFORM to produce
compilable COBOL.
BINTREE.STR Another sample structured program. It reads up to 100
20 byte records, stores them in a binary tree, and
displays them in ascending or descending sequence.
PSICO.DOC User Guide
==============================================================================
5. Use and Performance
==============================================================================
Type PSICO followed by the command-line parameters (see manual) , but note
that the program, and the files PLAY.ASK and HELP.ASC should be in the
current directory.
Example: to run the demonstration, type
PSICO MATCH3 C PLAY=MATCH3
5.1 ERRORS
==========
Run-time error 013 will be reported if the input file does not exist.
Error 001 usually means that you do not have enough memory to assign file
buffers - get rid of some pop-up (TSR) programs!
Please inform me of any other error messages reported.
5.2 HARDWARE REQUIREMENTS
=========================
Any IBM compatible PC, with 512k, one drive, and any monitor.
==============================================================================
6. History
==============================================================================
The program was originally developed in 1983 on an ICL mainframe. It has
been converted by amending and recompiling the COBOL source, hence the
large EXE file size.
Version 1.0 - 1990.
Version 1.1 - May 1991 Same program, different documentation!
Version 1.2 - February 1993 : see WHATSNEW for major changes
==============================================================================
7. Documentation
==============================================================================
Text file PSICO.DOC contains a user guide. You should also consult the COBFORM
user guide for more information.
==============================================================================
8. Latest news about COBFORM
==============================================================================
The new version has a Macro capability, in which textual replacement can be
performed upon standard code held in Macro definition files. (Unlike the
COPY REPLACING feature of COBOL, this facility can be used to replace PART
of a COBOL word.)
Use of pretested code in this way can make a significant contribution to the
creation of reliable programs. It can also be used to "hide" differences
between different dialects, so that the program is unchanged, but the Macro
definitions reflect the different environments, when using different
hardware.
The novel feature in THIS program is that the macro processing is fully
integrated with the structure preprocessor, so that structure commands may
be included within macro definitions, and macros may be included within
structures. Trace and Path analysis code, if required, is added AFTER the
expansion of the macro.
A single Macro definition may be as small as one line of text, or may be a
complete COBOL program! Note that nested macros are NOT supported, ie a
macro cannot itself include a macro call.
A chunk of plain COBOL code can be used as a parameterless macro - this lets
you change your COPY code into macros or even to carve up an exisiting program
just by copying it into .DEF files. You can then add the MACRO, MACBEGIN and
parameters later if necessary.